<?php
class Web_Plugin_Adwords 
	extends Zend_Controller_Plugin_Abstract
{
	
    public function routeStartup (Zend_Controller_Request_Abstract $request)
    {
        $session = Zend_Registry::get("session");
        
        $uri = $request->getRequestUri();
        
        if( strstr($uri, "?gclid")){
    		
        	$pos = strpos($uri, "?");
        	$gclid = substr($uri, $pos + 7 );
        	$uri = substr($uri, 0, $pos );
        	
        	$session->gclid = $gclid;
    	
    		$request->setRequestUri($uri);
    	}
        
    }
    
}
